class Queue{
    constructor(){
        this.items = [];
    }

    enqueue(){
        if(arguments.length != 1) {
            throw Error("only accept a argument");
        }

        this.items.push(arguments[0]);
    }

    dequeue(){
        if(!this.items.length) {
            throw Error('Empty queue');
        }
        return this.items.shift();
    }

    isEmpty(){
        return !this.items.length;
    }

    size(){
        return this.items.length;
    }
}

module.exports = Queue;